package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.HangUpdateLoginBean;
import com.xuxin.nantai.bean.PackInfoBean;
import com.xuxin.nantai.contract.PackUpdateContract;
import com.xuxin.nantai.model.PackUpdateModel;

/**
 * Created by xu_xin
 * Created on 2020.06.22 0022
 */
public class PackUpdatePresenter implements PackUpdateContract.Presenter {
    private PackUpdateModel model;
    private PackUpdateContract.View view;

    public PackUpdatePresenter(PackUpdateContract.View view) {
        model = new PackUpdateModel();
        this.view = view;
    }

    @Override
    public void getPackInfo(String FlowingCode, String LoginName) {
        if (null != model) {
            model.getPackInfo(this, FlowingCode, LoginName);
        }
    }

    @Override
    public void update(String LoginName,
                       String UserName,
                       String Guid,
                       String ID,
                       String cInvName,
                       String cInvCode,
                       String Color,
                       String PackQty,
                       String Check_BZ,
                       String CheckNum,
                       String FlowingCode,
                       String Remark,
                       String Result,
                       String InspectorName,
                       String InspectorCode,
                       String InspectTime,
                       String FacArea,
                       String DefectNum,
                       String DefectDes,
                       int IsReCheck) {
        if (null != model) {
            model.update(this,
                    LoginName,
                    UserName,
                    Guid,
                    ID,
                    cInvName,
                    cInvCode,
                    Color,
                    PackQty,
                    Check_BZ,
                    CheckNum,
                    FlowingCode,
                    Remark,
                    Result,
                    InspectorName,
                    InspectorCode,
                    InspectTime,
                    FacArea,
                    DefectNum,
                    DefectDes,
                    IsReCheck);
        }
    }

    @Override
    public void getLoginUser(String loginName) {
        if (null != model) {
            model.getLoginUser(this, loginName);
        }
    }

    @Override
    public void onSuccess(PackInfoBean packInfoBean) {
        if (null != view) {
            view.onSuccess(packInfoBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    @Override
    public void onSuccess(HangUpdateLoginBean hangUpdateLoginBean) {
        if (null != view) {
            view.onSuccess(hangUpdateLoginBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}